<template>
    <view class="main">
        <code-elf-guide v-if="guidePages"></code-elf-guide>
    </view>
</template>

<script>
    import codeElfGuide from '@/components/code-elf-guide/code-elf-guide.vue'
    export default {
        components: {
            codeElfGuide
          },
        data() {
            return {
                guidePages:false
            }
        },
        onLoad(option) {
			if (option.agent) {
                uni.setStorageSync('agent_code', option.agent)
            }
            this.loadExecution()
        },
        methods: {
            loadExecution: function(){
                /**
                 * 获取本地存储中launchFlag的值
                 * 若存在，说明不是首次启动，直接进入首页；
                 * 若不存在，说明是首次启动，进入引导页；
                 */
                try {
                    const value = uni.getStorageSync('launchFlag');
                    if (value) {
                        uni.redirectTo({
							 url: '/pages/home/home'
						});
                    } else {
                        this.guidePages = true
                    }
                } catch(e) { 
                    this.guidePages = true
                }
            }
        }
    }
</script>

<style lang="scss">
    page,.main{
        width: 100%;
        height: 100%;
    }
</style>
